using System;
using System.Collections.Generic;
using System.Linq;

namespace Green.Utility
{
    public class ComputeExpressionKey
    {
        public string Expression
        { get; set; }

        public Type ModelType
        {
            get;
            set;
        }

        public Type ResultType
        {
            get;
            set;
        }
        public ComputeExpressionKey(Type ModelType, Type ResultType, string Expression)
        {
            this.Expression = Expression;
            this.ModelType = ModelType;
            this.ResultType = ResultType;
        }

        public override bool Equals(object obj)
        {
            var o = obj as ComputeExpressionKey;
            if (o == null)
                return false;
            return this.Expression.Equals(o.Expression) && this.ResultType.Equals(o.ResultType) && this.ModelType.Equals(o.ModelType);
        }

        public override int GetHashCode()
        {
            return this.ResultType.GetHashCode() ^ this.ModelType.GetHashCode() ^ this.Expression.GetHashCode();
        }
    }
}
